<template>
	<view class="txt">
		<!-- <view class="" v-html="content"></view> -->
		<rich-text v-if="types==0" :nodes="content"></rich-text>
		<view v-if="types == 1">
			<web-view :src="typesurl"></web-view>
		</view>
	</view>
</template>

<script>
	import { getAgreement,getPrivacy} from '@/api/user.js';
	import { getIntroduction } from '@/api/live.js'
	import config from '@/config/config.js'
	export default {
		data(){
			return{
				type:1,
				types:0,
				content:'',
				typesurl:''
			}
		},
		onLoad(options) {
			console.log(options.type);
			switch (options.type){
				case '1':
					this.getIntroductions()
					break;
				case '2':
					this.getAgreements()
					break;
				case '3':
					this.getPrivacys()
					break;
				default:
					break;
			}
		},
		methods:{
			getIntroductions(){
				let that = this
				this.types = 0
				getIntroduction().then(res=>{
					that.content = res.data.data.live_introduction_platform
				})
			},
			getAgreements(){
				let that = this
				that.types = 1
				that.typesurl = config.baseUrl + '/platforms/user-agreement'
				// getAgreement().then(res=>{
				// 	// console.log(res.data)
				// 	that.content = res.data
				// }).catch()
			},
			getPrivacys(){
				let that = this
				that.types = 1
				that.typesurl = config.baseUrl + '/platforms/privacy-policy'
				// getPrivacy().then(res=>{
				// 	// console.log(res.data)
				// 	// that.content = res.data
				// 	uni.navigateTo({
				// 		url:res
				// 	})
				// })
			}
		}
	}
</script>

<style>
	.txt{
		padding: 0 20upx;
	}
</style>